function public_validate(obj,callback='',ignore=''){
    $(obj).validate({
        invalidHandler:function(form,validator){
            //只显示第一个错误信息
            $.each(validator.invalid,function(key,value){
                var tmpkey = key;
                validator.invalid = {};
                validator.invalid[tmpkey] = value;
                errorMsg = value;
                if (tmpkey!=='birthday'){
                    $('[name='+tmpkey+']').focus();
                }
                msg(errorMsg);
                return false;
            });
        },
        ignore:ignore,
        errorPlacement: function(error, element) {
        },
        rules: {
            mobile: {required: true, phone_number: true},
            reid: {required: true},
            nickname: {required: true},
            dfmobile: {required: true, phone_number: true},
            oldpassword: {required: true,minlength:6},
            oldpaypwd: {required: true,minlength:6},
            password: {required: true,minlength:6},
            conpassword: {required: true,equalTo:"#password"},
            code: {required: true,digits:true,minlength:6},
            verify: {required: true,digits:true,minlength:4},
            realname: {required: true,str:true},
            birthday: {required: true},
            idcard: {required: true,idcard:true},
            zhifubao: {required: true},
            bank_name: {required: true,str:true},
            consignee: {required: true},
            pid: {required:true},
            cid: {required:true},
            did: {required:true},
            bank_card: {required: true,digits:true},
            address: {required: true},
            money: {required: true,digits:true},
            amount: {required: true,digits:true},
            tx_type: {required: true},
            type: {required: true},
        },
        messages: {
            mobile: {
                required: "请输入手机号码",
            },
            reid: {
                required: "请输入推荐码",
            },
            nickname: {
                required: "请输入昵称",
            },
            dfmobile: {
                required: "请输入对方手机号码",
            },
            oldpassword: {
                required: "请输入原密码",
                minlength: "密码至少为6个字符",
            },
            oldpaypwd: {
                required: "请输入原密码",
                minlength: "密码至少为6个字符",
            },
            password: {
                required: "请输入密码",
                minlength: "密码至少为6个字符",
            },
            conpassword: {
                required: "请输入确认密码",
                equalTo: "两次密码不一致",
            },
            code: {
                required: "请输入验证码",
                digits: "验证码必须为数字",
                minlength: "验证码至少为6个字符",
            },
            verify: {
                required: "请输入验证码",
                digits: "验证码必须为数字",
                minlength: "验证码至少为4个字符",
            },
            realname: {
                required: "请输入真实姓名",
                str: "真实姓名只能为中文",
            },
            birthday: {
                required: "请选择生日",
            },
            idcard: {
                required: "请输入身份证号码",
                idcard: "身份证号码格式有误",
            },
            zhifubao: {
                required: "请输入支付宝",
            },
            bank_name: {
                required: "请输入开户银行",
                str: "开户银行只能为中文",
            },
            bank_card: {
                required: "请输入银行账号",
                digits: "银行账号格式有误",
            },
            consignee: {
                required: "请输入收货人",
            },
            pid: {
                required: "请选择省份",
            },
            cid: {
                required: "请选择城市",
            },
            did: {
                required: "请选择地区",
            },
            address: {
                required: "请输入详细地址",
            },
            money: {
                required: "请输入金额",
                digits: "金额只能为整数",
            },
            amount: {
                required: "请输入消费金额",
                digits: "消费金额只能为整数",
            },
            tx_type: {
                required: "请选择提现账户",
            },
            type: {
                required: "请选择转化类型",
            },
        },errorElement: "div"
        ,submitHandler:function (form) {
            if (callback){
                callback();
            }
        }
    }),jQuery.validator.addMethod("phone_number", function (value, element) {
        var length = value.length;
        var phone_number = /^((1[2-9])+\d{9})$/
        return this.optional(element) || (length == 11 && phone_number.test(value));
    }, "手机号码格式错误"),jQuery.validator.addMethod("idcard", function (value, element) {
        var idcard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
        return this.optional(element) ||  idcard.test(value);
    }, "身份证号码格式错误"),jQuery.validator.addMethod("str", function (value, element) {
        var str = /^[\u4e00-\u9fa5]+$/
        return this.optional(element) ||  str.test(value);
    }, "必须为中文"),jQuery.validator.addMethod("addresss", function (value, element) {
        if (value=='请选择'){
            return false;
        } else {
            return true;
        }
    }, "请选择");
}